<?php

require_once 'Response.php';
require_once 'DB.php';

//1. 接收id
$id = $_REQUEST['id'];

//2. 查询数据
$pdo = DB::getInstance()->connect();
$stmt = $pdo->query("SELECT * FROM goods LEFT JOIN type ON goods.type_id = type.id WHERE goods.id = {$id}");
$item = $stmt->fetch();
// $item['time'] = date('Y-m-d', $item['create_time']);

//3. 返回结果
Response::json(200, '成功', $item);